import 'package:flutter/material.dart';

class ListViewCase extends StatelessWidget {
  const ListViewCase({Key? key}) : super(key: key);
  List<Widget> getList() {
    List<Widget> list = [];
    for (var i = 0; i < 10; i++) {
      list.add(Container(
        width: double.infinity,
        margin: EdgeInsets.all(10),
        decoration: BoxDecoration(
            color: Colors.red, borderRadius: BorderRadius.circular(20)),
        height: 100,
        alignment: Alignment.center,
        child: Text(
          "第${i + 1}个商品信息",
          style: TextStyle(color: Colors.blue, fontSize: 30),
        ),
      ));
    }
    return list;
  }

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: getList(),
    );
  }
}
